<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue-2.6.12开发.js"></script>
</head>

<body>
    <div id="root">
    </div>

    <script>
        
        const student = Vue.extend({
            template: `
            <div>
                <h2>学生姓名:{{name}}</h2>
                <h3>学生年龄:{{age}}</h3>
            </div>
            `,
            data() {
                return {
                    name: '陈嘉兴',
                    age: 23
                }
            }
        })
        const school = Vue.extend({
            template: `
            <div>
             <h1>学校名称:{{name}}</h1>
             <student></student>
             </div>
                     `,
            data() {
                return {
                    name: 'B站大学'
                }
            },
            components: {
                student
            }
        })
        const hello = Vue.extend({
            template: `
            <div>
            <h2>{{msg}}</h2>
            </div>
            `,
            data() {
                return {
                    msg: '早上好!'
                }
            }
        })
        const app = Vue.extend({
            template: `
            <div>
            <hello></hello>
            <school></school>
            </div>
            `,
            components: {
                school,
                hello
            }
        })

        new Vue({
            // vm本身有真实dom容器 所以它里面的template不写根元素是可以的
            template: `
            <app></app>
            `,
            el: '#root',
            components: {
                app
            }
        })
    </script>
</body>

</html>